package com.hfut.se.zhisms;

import android.content.Context;
import android.os.Build;
import android.provider.Telephony;

/**
 * This Class is used to get the environment of application
 * <p/>
 * Created by lynn on 2015/11/10.
 */
public class EnvironmentTools {

    /**
     * @return Is Android 4.4 or higher.
     */
    public static boolean isKitkatOrHigher() {
        return Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT;
    }

    /**
     * @return is ZhiSms default SMS app.
     */
    public static boolean isDefaultSMSApp(Context context) {
        final String packageName = context.getPackageName();

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            // Android 4.4 or higher.
            if (!Telephony.Sms.getDefaultSmsPackage(context).equals(packageName)) {
                return false;
            }
        }
        return true;
    }

}
